import pickle

F=open('prime201.txt','r')
l=pickle.load(F)
F.close()

n=1
diagonals=1
layer=1
prime=0
step=2
radio=1

begin=0
lpart=l[begin:begin+10000]

while radio>0.1:
    side=4
    diagonals+=side
    while side>0:
      n+=step
      if n>lpart[9999]:
          begin+=9998
          lpart=l[begin:begin+10000]

      if n in lpart:
          prime+=1
      side-=1
    step+=2
    layer+=2
    radio=prime*1.0/diagonals
    print "n",n,"layer",layer,"radio",radio


